<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
<title>我是货源商-完成注册</title>
<link rel="stylesheet" href="./layui/2.3.0/css/layui.css?t=1527693307626"  media="all">
<style>
#bizlicense,#repFront,#repBack{
width:250px;
height:200px;
}
</style>
 </head>
<body>
<ul class="layui-nav">
  <li class="layui-nav-item"><a href="">物流</a></li>
  
</ul>
<div class="layui-container">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>填写企业信息-上传文件</legend>
</fieldset>
<form class="layui-form" action="">
	<input id="fid" name="fid" type="hidden" value="1">
	<div class="layui-row">
	  	<div class="layui-upload layui-col-xs4">
	  	<button type="button" class="layui-btn" id="bizlicenseBtn"><i class="layui-icon"></i>上传企业营业执照</button>
	  	<input type="hidden" name="bizlicense">
	  	<div class="layui-upload-list">
	    	<img class="layui-upload-img" id="bizlicense">
	    	<p id="bizlicenseText"></p>
	  	</div>
		</div> 
	 	<div class="layui-upload layui-col-xs4"  >
	  		<button type="button" class="layui-btn" id="repFrontBtn"><i class="layui-icon"></i>上传企业法人身份证件正面</button>
	  		<div class="layui-upload-list ">
	   			 <img class="layui-upload-img" id="repFront">
	   			 <p id="repFrontText"></p>
	  		</div>
		</div>  
	  <div class="layui-upload layui-col-xs4" >
	  	<button type="button" class="layui-btn" id="repBackBtn"><i class="layui-icon"></i>上传企业法人身份证件背面</button>
	  	<div class="layui-upload-list ">
	    	<img class="layui-upload-img" id="repBack">
	    	<p id="repBackText"></p>
	  	</div>
	  </div>
	</div>
	<div align="center" style="text-align:center;">
	<div><input type="checkbox" lay-skin="primary" title="我已阅读并同意"><p></p></div>
	<button type="button" style="background:#F16622;margin-top:40px;" class="layui-btn layui-btn-normal" id="nextBtn">下一步</button>
	  	
	</div>
 </form>
</div>


<script src="./layui/2.3.0/layui.all.js" charset="utf-8"></script>
<script>
layui.use('upload', function(){
  var $ = layui.jquery
  ,upload = layui.upload
  ,fid=$("#fid").val();
  
  //普通图片上传
  var uploadBizlicense = upload.render({
    elem: '#bizlicenseBtn'
    ,url: '../module/Supplier-uploadBizLicense.action?fid='+fid
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#bizlicense').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(!res.success){
        return layer.msg('上传失败');
      }
      $("input[name=bizlicense]").setValue(res["data"]);
      //上传成功
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#bizlicenseText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
    	  uploadBizlicense.upload();
      });
    }
  });
  
  var uploadRepFront = upload.render({
	    elem: '#repFrontBtn'
	    ,url: '../module/Supplier-uploadOrgRepFront.action?fid='+fid
	    ,before: function(obj){
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){
	        $('#repFront').attr('src', result); //图片链接（base64）
	      });
	    }
	    ,done: function(res){
	      //如果上传失败
	      if(!res.success){
	        return layer.msg('上传失败');
	      }
	      $("input[name=repFront]").setValue(res["data"]);
	      //上传成功
	    }
	    ,error: function(){
	      //演示失败状态，并实现重传
	      var demoText = $('#repFrontText');
	      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
	      demoText.find('.demo-reload').on('click', function(){
	    	  uploadRepFront.upload();
	      });
	    }
	  });
  
  var uploadRepBack = upload.render({
	    elem: '#repBackBtn'
	    ,url: '../module/Supplier-uploadOrgRepBack.action?fid='+fid
	    ,before: function(obj){
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){
	        $('#repBack').attr('src', result); //图片链接（base64）
	      });
	    }
	    ,done: function(res){
	      //如果上传失败
	      if(!res.success){
	        return layer.msg('上传失败');
	      }
	      $("input[name=repBack]").setValue(res["data"]);
	      //上传成功
	    }
	    ,error: function(){
	      //演示失败状态，并实现重传
	      var demoText = $('#repFBackText');
	      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
	      demoText.find('.demo-reload').on('click', function(){
	    	  uploadRepBack.upload();
	      });
	    }
	  });
});
</script>
</body>
</html>